/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upn.sigemfi.ope.bc;

import edu.upn.sigemfi.ope.be.Boveda;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Paulo
 */
@Stateless
public class BovedaFacade implements BovedaFacadeLocal {

    @PersistenceContext
    private EntityManager em;

    public void create(Boveda boveda) {
        em.persist(boveda);
    }       

    public void edit(Boveda boveda) {
        em.merge(boveda);
    }

    public void remove(Boveda boveda) {
        em.remove(em.merge(boveda));
    }

    public Boveda find(Object id) {
        return em.find(Boveda.class, id);
    }

    public List<Boveda> findAll() {
        return em.createQuery("select object(o) from Boveda as o").getResultList();
    }
}
